package unit_4;
import java.util.Scanner;

public class BMICalculator {
    double weight, height, bmi;
    public BMICalculator(double weight, double height){
        this.height = height;
        this.weight = weight;
    }
    public double calculate(){
        this.bmi = this.weight / (this.height * this.height);
        return bmi;
    }
    public boolean isOverWeight(){
        return bmi > 25;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.print("身高：");
        double weight = sc.nextDouble();
        System.out.print("体重：");
        double height = sc.nextDouble();
        BMICalculator bc = new BMICalculator(weight, height);
        double bmi = bc.calculate();
        System.out.println("BMI: " + bmi);
        System.out.println((bc.isOverWeight() ? "超重" : "不超重"));
    }
}
